// var events=require('events'); 
// var eventEmitter = new events.EventEmitter();
// eventEmitter.on('say',function(name){ 
//     console.log('Hello',name); 
// })
// eventEmitter.emit('say','Jony yu')

function Events(){ 
    this.on=function(eventName,callBack){ 
        if(!this.handles){ 
            this.handles={}; 
        }
        if(!this.handles[eventName]){ 
            this.handles[eventName]=[]; 
        }
        this.handles[eventName].push(callBack); 
    }
    this.emit=function(eventName,obj){ 
        if(this.handles[eventName]){ 
            for(var i=0;o<this.handles[eventName].length;i++){ 
                this.handles[eventName][i](obj); 
            }}
        }
        return this; 
}
var events=new Events(); 
events.on('say',function(name){ 
    console.log('Hello',nama) 
}); 
events.emit('say','Jony yu');